package com.xjgz.aio.socket;

import com.xjgz.aio.socket.transport.AioSession;

public interface MessageProcessor<T> {

    /**
     * 处理接收到的消息
     */
    void process(AioSession session, T message);

    default void stateEvent(AioSession session, StateMachineEnum stateMachineEnum, Throwable throwable) {
        if (stateMachineEnum == StateMachineEnum.DECODE_EXCEPTION || stateMachineEnum == StateMachineEnum.PROCESS_EXCEPTION) {
            throwable.printStackTrace();
        }
    }

}
